//2. 二维整型数组，求所有元素平均值，求每行最大值，求每列最小值。
#include<stdio.h>
#define N 3
#define M 3

int main()
{
	int i,j,sum = 0,max = 0,min = 100;
	int a[N][M] = {{2,5,9},{3,5,7},{4,6,10}};
	for(i = 0; i < N ; i++)
	{
		max = a[i][0];
		for(j = 0; j < M; j++)
		{
			if(max < a[i][j])
			{
				max = a[i][j];
			}
			sum += a[i][j];
		}	
	printf("第%d行最大值为%d\n",i+1,max);
	}
		
	for(j = 0; j < M ; j++)
	{
		min = a[0][j];
		for(i = 0; i < N; i++)
		{
			if(min > a[i][j])
			{
				min = a[i][j];
			}
		}	
	printf("第%d列最小值为%d\n",j+1,min);
	}
	float avge = sum*1.0 / (N * M);
	printf("平均值为%f\n",avge);
	return 0;
}
